package com.caishi.lkx.user.model;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.zzw.common.entity.impl.BaseEntity;
import com.zzw.common.mysql.handler.DataEncryptionHandler;
import com.caishi.lkx.user.ienum.type.UserAccountType;
import lombok.*;

/**
 * @author by keray
 * date:2021/4/6 10:42 上午
 * 用户存在多个身份时 可以存在多个用户名登录
 */
@EqualsAndHashCode(callSuper = true)
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@TableName("cu_user_login")
public class LoginInfoModel extends BaseEntity<LoginInfoModel> {

    private String userId;

    private UserAccountType loginType;

    @TableField(typeHandler = DataEncryptionHandler.class)
    private String account;

    @TableField(typeHandler = DataEncryptionHandler.class)
    private String certificate;

    @TableField("`lock`")
    private Boolean lock;

    @TableField("`enable`")
    private Boolean enable;

    @TableField(exist = false)
    private IUserModel<?> user;

    public static void main(String[] args) {
        System.out.println(DataEncryptionHandler.decrypt("04bba87803d5e1271e6b245832c3dda17bc95d860e9b78315bf00ac40526490914f86ca0573faa3c14cd99d7169269276f6bfbed"));
    }

}
